﻿@namespace MudBlazor.Docs.Examples

<MudText Typo="Typo.h6" Class="mud-width-full">@(pizza == null ? "Nothing selected yet." : $"Pizza: {pizza.Name}")</MudText>

<MudSelect T="Pizza" @bind-Value="@pizza" ToStringFunc="@converter" Label="Select your pizza" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined">
    <MudSelectItem Value="@(new Pizza() { Name="Cardinale"})" />
    <MudSelectItem Value="@(new Pizza() { Name="Diavolo"})" />
    <MudSelectItem Value="@(new Pizza() { Name="Margarita"})" />
    <MudSelectItem Value="@(new Pizza() { Name="Spinaci"})" />
</MudSelect>

@code {
    Pizza pizza;

    public class Pizza
    {
        public string Name { get; set; }
    }

    Func<Pizza,string> converter = p => p?.Name;
}